package cn.ava.basic.config;

import cn.ava.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName: LoginConfig
 * @Description: 登录拦截配置
 * @Author: Avavaava
 * @Date: 2022/7/26 15:19
 * @version: 23.53
 *
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    /**
     * @Title: addInterceptors
     * @Description: 拦截路径放行路径配置
     * @Author: Avavaava
     * @Version: 23.53
     * @Date: 2022/7/26 15:20
     * @param:
     * @return:
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 配置拦截器
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastdfs/**")
                .excludePathPatterns("/shop/settlement/**")
                .excludePathPatterns("/shop/audit/**")
                .excludePathPatterns("/shop/export/**")
                .excludePathPatterns("/shop/import/**")
                .excludePathPatterns("/user/register/**");
    }
}
